package com.test1;

import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;
import org.springframework.core.io.ClassPathResource;

public class Test {

    public static void main(String[] args) {
//        XmlBeanFactory beanFactory = new XmlBeanFactory(new ClassPathResource("applicationContext.xml"));
//        ApplicationContext beanFactory = new FileSystemXmlApplicationContext("D:\\workspace\\spring_l\\src\\main\\resources\\applicationContext.xml");
        AbstractApplicationContext beanFactory = new ClassPathXmlApplicationContext("applicationContext.xml");
        People people1 = (People) beanFactory.getBean("people");
        People people2 = (People) beanFactory.getBean("people");
        people1.getMessage();
        System.out.println(people1);
        System.out.println(people2);
        beanFactory.registerShutdownHook();

    }

}
